/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package structure;

/**
 *
 * @author Gary Furlong
 */
public class DataPoint {
    private int id;
    private Variable variable;
    private State state;

    public DataPoint(int dataPointId, Variable var, State sta){
        id = dataPointId;
        variable = var;
        state = sta;
    }

    public DataPoint(DataPoint d){
        id = d.getId();
        variable = d.getVariable();
        state = d.getState();
    }

    public void setVariable(Variable var){
        variable = var;
    }

    public void setState(State sta){
        state = sta;
    }

    public int getId(){
        return id;
    }

    public Variable getVariable(){
        return variable;
    }

    public State getState(){
        return state;
    }

    @Override public boolean equals(Object d){
        DataPoint data = (DataPoint)d;

        if((id==data.getId())&&(variable==data.getVariable())&&(state==data.getState())){
            return true;
        }
        else return false;
    }

    @Override public String toString(){
        StringBuilder result = new StringBuilder();
        String NEW_LINE = System.getProperty("line.separator");

        result.append("DataPoint ID: " + id + " ");
        result.append("Variable: " + variable.getId() + " ");
        result.append("State: " + state.getStateNumber() + "\n");

        return result.toString();
    }
}
